# surfparc_mass_images_20070917.bash
# mass images

resultsdir=/mri_projects/ASD_Analysis/Results

function combine_data_type() {
  src_sub_dir=$1
  fig_type=$2

  lh_front_file=$resultsdir"/screencaps/"$src_sub_dir"/fsaverage4_"$fig_type"_lh_lat.tif"
  lh_back_file=$resultsdir"/screencaps/"$src_sub_dir"/fsaverage4_"$fig_type"_lh_med.tif"
  lh_data_item_file=$resultsdir"/screencaps/"$src_sub_dir"/fsaverage4_"$fig_type"_lh_front_back.tif"
  convert $lh_front_file $lh_back_file -gravity north +append $lh_data_item_file
  #
  lh_front_trans_file=$resultsdir"/screencaps/"$src_sub_dir"_lh_lat.png"
  lh_back_trans_file=$resultsdir"/screencaps/"$src_sub_dir"_lh_med.png"
  lh_data_item_trans_file=$resultsdir"/screencaps/"$src_sub_dir"_lh_front_back.png"
  convert $lh_front_file -transparent black $lh_front_trans_file
  convert $lh_back_file -transparent black $lh_back_trans_file
  convert $lh_front_trans_file $lh_back_trans_file -gravity north +append $lh_data_item_trans_file

  rh_front_file=$resultsdir"/screencaps/"$src_sub_dir"/fsaverage4_"$fig_type"_rh_lat.tif"
  rh_back_file=$resultsdir"/screencaps/"$src_sub_dir"/fsaverage4_"$fig_type"_rh_med.tif"
  rh_data_item_file=$resultsdir"/screencaps/"$src_sub_dir"/fsaverage4_"$fig_type"_rh_front_back.tif"
  convert $rh_back_file $rh_front_file -gravity north +append $rh_data_item_file
  #
  rh_front_trans_file=$resultsdir"/screencaps/"$src_sub_dir"_rh_lat.png"
  rh_back_trans_file=$resultsdir"/screencaps/"$src_sub_dir"_rh_med.png"
  rh_data_item_trans_file=$resultsdir"/screencaps/"$src_sub_dir"_rh_front_back.png"
  convert $rh_front_file -transparent black $rh_front_trans_file
  convert $rh_back_file -transparent black $rh_back_trans_file
  convert $rh_back_trans_file $rh_front_trans_file -gravity north +append $rh_data_item_trans_file

  final_name=$resultsdir"/screencaps/wb_"$src_sub_dir"_fs4_"$fig_type".png"
  convert $lh_data_item_file $rh_data_item_file -gravity north +append $final_name

  final_name=$resultsdir"/screencaps/wb_trans_"$src_sub_dir"_fs4_"$fig_type".png"
  convert $lh_data_item_trans_file $rh_data_item_trans_file -gravity north +append $final_name

  rm $lh_front_trans_file
  rm $lh_back_trans_file
  rm $rh_front_trans_file
  rm $rh_back_trans_file

  rm $lh_data_item_trans_file
  rm $rh_data_item_trans_file
  rm $lh_data_item_file
  rm $rh_data_item_file
}

# combine_data_type 'OHSU_ASD_inter' 'if'
# combine_data_type 'OHSU_ASD_intra' 'if'
# combine_data_type 'OHSU_ASD_inter_regressintra' 'if'
#
# combine_data_type 'OHSU_HC_inter' 'if'
# combine_data_type 'OHSU_HC_intra' 'if'
# combine_data_type 'OHSU_HC_inter_regressintra' 'if'
combine_data_type 'NYU_ASD_inter' 'if'
